package StringBuffer;

/**
 * @author 王艺锡
 * @version 1.0
 */
public class StringBufferMethod {
    public static void main(String[] args) {
        StringBuffer s = new StringBuffer("hello");
        //增:append
        s.append(',');
        s.append("wyx");
        s.append("xy").append("99").append("66");
        System.out.println(s);

        //删:delect
        s.delete(2,6);//删除从索引2开始到索引6之前的字符
        System.out.println(s);

        //改:replace
        s.replace(5,7,"gly");
        System.out.println(s);

        //查找:indexOf
        int index = s.indexOf("wyx");
        System.out.println(index);

        //插:insert--在索引的位置之前插入字符
        s.insert(2,"llo");
        System.out.println(s);

        //长度:length
        System.out.println(s.length());


    }
}
